﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;

namespace _2014112107
{
    public partial class ManagerSelectUser : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSelect_Click(object sender, EventArgs e)
        {
            string strCn = "server=pc.hstc.cn;database=dhd2014112107;uid=2014112107;pwd=19951106";
            SqlConnection cn = new SqlConnection(strCn);
            try
            {
                cn.Open();
                string strUserName = this.txtUserName.Text;
                //忽略检测规范

                string strSql = "SELECT   *      FROM    UserInfo         WHERE   (UserName = N'" + strUserName + "')";
                SqlCommand cmd = new SqlCommand(strSql, cn);
                SqlDataReader Fr = cmd.ExecuteReader();

                this.GridView1.DataSource = Fr;
                this.GridView1.DataBind();
                Fr.Close();
            }
            catch (Exception ex)
            {
                this.lblInfo.Text = ex.Message;
            }
            finally
            {
                cn.Close();
            }
        }
    }
}